Fix misleading slug display in stardag modal CLI (v0.7.3)#143
Conversation
The workspace/environment slug printed by `stardag modal deploy` and `stardag modal stardag-api-key create` was read from the active CLI profile's TOML, so when env vars or a custom `config_provider` override the resolved IDs the slug could refer to a different env than the resolved UUID — e.g. hypothetically `Environment: <env-a-uuid> (env-b-slug)` where the UUID resolves to env A but the slug is read from a profile pointing at env B. Replace `_get_profile_slugs` with `_resolve_display_slugs` which reverse-looks up the slug from the resolved UUID via the id-cache, falling back to omitting the slug when there is no cache hit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
633e9b4 to
1f19a92
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes misleading slug output in the stardag modal CLI by deriving the displayed workspace/environment slugs from the resolved UUIDs (via the local id-cache) rather than from the active CLI profile TOML, and documents the change for release v0.7.3.
Changes:
- Added UUID → slug reverse-lookup helpers to
stardag/config/cache.pyusing~/.stardag/id-cache.json. - Updated
stardag/_cli/modal.pyto use reverse-lookups for display (_resolve_display_slugs) instead of reading profile TOML slugs. - Added
v0.7.3entries toCHANGELOG.mdandRELEASE_NOTES.md.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
RELEASE_NOTES.md |
Documents the CLI display fix for v0.7.3. |
lib/stardag/src/stardag/config/cache.py |
Adds cached reverse lookups (UUID → slug) for workspace/environment. |
lib/stardag/src/stardag/_cli/modal.py |
Switches slug display logic to use id-cache reverse lookup. |
CHANGELOG.md |
Adds a v0.7.3 changelog entry describing the CLI display fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Address review feedback on PR #143: 1. `_resolve_display_slugs` previously read `registry_name` from `get_config()`, but both call sites resolve IDs under a temporarily overridden `STARDAG_PROFILE` and restore the env before printing — so `get_config()` could point at a different registry than the IDs came from, producing reverse-lookup misses on multi-registry setups. Derive `registry_name` from the actual `STARDAG_API_URL` instead. 2. Collapse `get_cached_workspace_slug` + `get_cached_environment_slug` into a single `get_cached_slugs` helper so the id-cache file is loaded once per CLI invocation instead of twice. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Thanks for the review — both comments addressed in df7d933. 1. Registry-name mismatch (real bug, fixed)You're right that the original Fixed by pinning the registry to the URL the IDs were actually resolved against:
2. Double id-cache load (minor, fixed)Collapsed VerifiedReverse lookup against a populated id-cache returns the slug that actually maps to the resolved UUID. Unknown UUIDs and URLs that don't match any configured TOML registry both fall back to no slug, instead of silently displaying a wrong one. 🤖 Generated with Claude Code |
Summary
stardag modal deployandstardag modal stardag-api-key createprinted the workspace/environment slug by reading the active CLI profile's TOML (prof["environment"]). When env vars or a customconfig_providerdefault-factory override the resolved IDs, the slug pulled from the active profile may not correspond to the resolved UUID — producing hypothetical output like:…where the UUID resolves to environment A but the slug is read from a profile pointing at environment B. Deployed bytes were always correct; only the printed line was misleading.
Fix
get_cached_workspace_slug/get_cached_environment_slugreverse lookups instardag/config/cache.py(UUID → slug, against~/.stardag/id-cache.json)._get_profile_slugswith_resolve_display_slugsinstardag/_cli/modal.py. The slug shown is now always the one that actually maps to the resolved UUID, or omitted when there is no cache entry — instead of guessing from the active profile.Includes minimal
CHANGELOG.md+RELEASE_NOTES.mdentries for v0.7.3.Test plan
pre-commit runpasses (ruff,pyright,prettier)stardag modal deploy ...from a project that overridesSTARDAG_WORKSPACE_ID/STARDAG_ENVIRONMENT_IDvia a customconfig_providerdefault factory now prints the slug matching the override, not the active profile's slug🤖 Generated with Claude Code